package com.dayaokeji.server_api.api;

import com.dayaokeji.server_api.Page;
import com.dayaokeji.server_api.ServerResponse;
import com.dayaokeji.server_api.domain.CreateMeeting;
import com.dayaokeji.server_api.domain.InteractiveCollect;
import com.dayaokeji.server_api.domain.Meeting;
import com.dayaokeji.server_api.domain.MeetingInfo;
import com.dayaokeji.server_api.domain.Member;
import com.dayaokeji.server_api.domain.SignResult;

import java.util.List;
import java.util.Map;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by Gorden on 2017/9/29.
 * 会议相关API
 */

public interface MeetingApi {

    /**
     * 创建者会议列表
     * @return
     */
    @GET("course/meeting/select")
    Call<ServerResponse<Page<Meeting>>> createTodayList(
            @Query("start") int start,
            @Query("teacherId") String teacherId,
            @Query("startTime") String startTime,
            @Query("length") int length
    );

    /**
     * 参与者会议列表
     * @param start
     * @param userId
     * @param startTime
     * @param length
     * @return
     */
    @GET("course/meeting/select/user")
    Call<ServerResponse<Page<Meeting>>> userTodayList(
            @Query("start") int start,
            @Query("userId") String userId,
            @Query("startTime") String startTime,
            @Query("length") int length
    );

    /**
     * 查询会议成员信息
     * @param meetingId
     * @return
     */
    @GET("course/meeting/member")
    Call<ServerResponse<List<Member>>> member(
            @Query("meetingId") int meetingId);

    /**
     * 会议签到
     * @param params
     * @return
     */
    @POST("course/meeting/sign")
    Call<ServerResponse<SignResult>> sign(@Body Map<String,String> params);

    /**
     * 查询会议室
     * @return
     */
    @GET("course/meetingroom/select")
    Call<ServerResponse<Page<MeetingInfo>>> meetingInfo(
            @Query("id") String id,
            @Query("universityId") String universityId,
            @Query("start") int start,
            @Query("length") int length
            );
    /**
     * 查询会议室列表
     * @return
     */
    @GET("course/meetingroom/select")
    Call<ServerResponse<Page<MeetingInfo>>> meetingInfoList(
            @Query("universityId") String universityId,
            @Query("start") int start,
            @Query("length") int length
    );

    /**
     * 删除会议
     * @param params
     * @return
     */
    @POST("course/meeting/delete")
    Call<ServerResponse<Void>> delete(@Body Map<String,String> params);

    /**
     * 加入会议
     * @param params
     * @return
     */
    @POST("course/meeting/addMember")
    Call<ServerResponse<Void>> addMeeting(@Body Map<String,Object> params);

    /**
     * 创建会议
     * @param createMeeting
     * @return
     */
    @POST("course/meeting/create")
    Call<ServerResponse<Void>> create(@Body CreateMeeting createMeeting);

    /**
     * 查询历史会议-创建者-时间查询
     * @param teacherId
     * @param startTime
     * @param start
     * @param length
     * @return
     */
    @GET("course/meeting/select")
    Call<ServerResponse<Page<Meeting>>> createMeetingHistory(
            @Query("teacherId") String teacherId,
            @Query("startTime") String startTime,
            @Query("start") int start,
            @Query("length") int length
    );

    /**
     * 查询历史会议-创建者-关键字查询
     * @param teacherId
     * @param start
     * @param length
     * @param keyword
     * @return
     */
    @GET("course/meeting/select")
    Call<ServerResponse<Page<Meeting>>> createMeetingHistory(
            @Query("teacherId") String teacherId,
            @Query("start") int start,
            @Query("length") int length,
            @Query("keywords") String keyword
    );

    /**
     * 查询历史会议-参与者-时间查询
     * @param userId
     * @param startTime
     * @param start
     * @param length
     * @return
     */
    @GET("course/meeting/select/user")
    Call<ServerResponse<Page<Meeting>>> userMeetingHistory(
            @Query("userId") String userId,
            @Query("startTime") String startTime,
            @Query("start") int start,
            @Query("length") int length
    );

    /**
     * 查询历史会议-参与者-关键字查询
     * @param userId
     * @param start
     * @param length
     * @return
     */
    @GET("course/meeting/select/user")
    Call<ServerResponse<Page<Meeting>>> userMeetingHistory(
            @Query("userId") String userId,
            @Query("start") int start,
            @Query("length") int length,
            @Query("keywords") String keyword
    );

    /**
     * 查询会议byid
     * @param start
     * @param length
     * @return
     */
    @GET("course/meeting/select/user")
    Call<ServerResponse<Page<Meeting>>> searchMeetingById(
            @Query("id") String id,
            @Query("start") int start,
            @Query("length") int length

    );

    /**
     * 查询会议byid
     * @param start
     * @param length
     * @return
     */
    @GET("course/meeting/select/user")
    Call<ServerResponse<Page<Meeting>>> findMeetingById(
            @Query("detailId") String detailId,
            @Query("start") int start,
            @Query("length") int length
    );

    /**
     * 互动收集器
     * @param interactiveCollect
     * @return
     */
    @POST("course/meeting/collect")
    Call<ServerResponse<Integer>> collect(@Body InteractiveCollect interactiveCollect);

    /**
     * 根据ID查询会议信息
     * @param id
     * @return
     */
    @GET("course/meeting/selectMeetingById")
    Call<ServerResponse<Meeting>> findMeetingById(@Query("id") int id);
}
